package main

import (
	"fmt"
	"net"
)

func main() {
	conn, err := net.Dial("tcp", "localhost:8000")
	if err != nil {
		fmt.Println("net.Dial err = ", err)
		return
	}
	defer conn.Close()

	var str string
	for {
		fmt.Println("请输入你要传输的内容: ")
		fmt.Scan(&str)
		_, err := conn.Write([]byte(str))
		if err != nil {
			fmt.Println("conn.Write err = ", err)
			return
		}
	}

}
